import { Controller, Get, Post, Body, Patch, Param, UploadedFile, UseInterceptors} from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { UserService } from './user.service';
import { diskStorage } from 'multer';
import { extname } from 'path';
import { CreateUserDto,findUserDto } from './dto/create-user.dto';
import {UpdateUserDto } from './dto/update-user.dto';
@Controller('user')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Post('add')
  create(@Body() createUserDto: CreateUserDto) {
    return this.userService.create(createUserDto);
  }
 
  @Post('findAll')
  findAll(@Body() query:{keyWord:string,page:number,pageSize:number}) {
    console.log(query);
    
    return this.userService.findAll(query);
  }
  @Post('findOne')
  findOne(@Body() findUserDto:findUserDto) {
    return this.userService.findOne(findUserDto);
  }
 
 
  @Post('update')
  update( @Body() updateUserDto: UpdateUserDto) {
    return this.userService.update(updateUserDto);
  }
 
  @Post('remove')
  remove(@Param('id') id: string) {
    return this.userService.remove(+id);
  }
}